<?php
/*
  $Id: default_specials.php,v 2.0 2003/06/13

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2003 osCommerce

  Released under the GNU General Public License
*/
?>
<!-- default_specials //-->

<?php 
echo '<table cellspacing="0" cellpadding="0" width="100%" border="0">';
// BOF: Lango Added for template MOD
if (MAIN_TABLE_BORDER == 'yes'){
  table_image_border_top2(false, false, sprintf(TABLE_HEADING_DEFAULT_SPECIALS, strftime('%B')));
} else {
echo sprintf(TABLE_HEADING_DEFAULT_SPECIALS, strftime('%B'));
}

// EOF: Lango Added for template MOD
echo '<table cellspacing="0" cellpadding="0" width="100%" border="0" class="product">';


 $new = tep_db_query("select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and s.status = '1' order by s.specials_date_added DESC limit " . MAX_DISPLAY_SPECIAL_PRODUCTS);

 $info_box_contents = array();
  $row = 0;
  $col = 0;
  $rows=0;
  $colum=0;
  while ($default_specials = tep_db_fetch_array($new)) {
  
    $default_specials['products_name'] = tep_get_products_name($default_specials['products_id']);


    $default_specials_query_description = tep_db_query("select products_description  from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$default_specials['products_id'] . "' and language_id = '" . (int)$languages_id . "'");

    $default_specials_description = tep_db_fetch_array($default_specials_query_description);



	$r_name = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $default_specials['products_id']) . '">' . $default_specials['products_name'] . '</a>';
	
    $r_pic = tm_image_border('<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $default_specials['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $default_specials['products_image'], $default_specials['products_name'], MEDIUM_IMAGE_WIDTH, MEDIUM_IMAGE_HEIGHT) . '</a>');
 
	if (tep_get_products_special_price($default_specials['products_id'])) {
		  $r_price = '<s>' .  $currencies->display_price($default_specials['products_price'], tep_get_tax_rate($default_specials['products_tax_class_id'])) . '</s>' . PRICE_SEPARATOR . '<span class="productSpecialPrice">' . $currencies->display_price(tep_get_products_special_price($default_specials['products_id']), tep_get_tax_rate($default_specials['products_tax_class_id'])) . '</span>';

		} else {
		  $r_price = '<span class="productSpecialPrice">' . $currencies->display_price($default_specials['products_price'], tep_get_tax_rate($default_specials['products_tax_class_id'])) . '</span>';
		}
		
    $r_desc = substr( $default_specials_description['products_description'],0,MAX_DESC_MODULE).'...';
		
	$r_view = '<a href="' . tep_href_link('product_info.php','products_id=' . $default_specials['products_id']) . '">' .tep_image_button('button_details.gif').'</a>';

	$r_buy = '<a href="'.tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $default_specials['products_id']).'">' .tep_image_button('button_in_cart.gif').'</a>';




echo tep_list_products_row ($r_pic, $r_name, $r_price, $r_desc, $r_view, $r_buy);


      $column ++;
      if ($column >= COLUMN_COUNT) {
        $row ++;
        $column = 0;
      }
    }

  echo '</table>';




if (MAIN_TABLE_BORDER == 'yes'){
  table_image_border_bottom2(false, false, '');
}

  echo '</table>
  
  <img src="'.DIR_WS_TEMPLATES . TEMPLATE_NAME.'/images/spacer.gif" alt="" width="1" height="4" /><br>';
?>
<!-- default_specials_eof //-->
